import React from 'react';
import { features, useTablePipeline } from 'ali-react-table';
import { TjTable } from '@/pages/ETrade/components';

export default ({ columns, dataSource }) => {
  const pipeline = useTablePipeline()
    .input({ columns, dataSource })
    .primaryKey('id')
    .use(
      features.treeMode({
        defaultOpenKeys: (dataSource || []).map((x) => x.id),
        indentSize: 0,
      }),
    );

  return <TjTable useVirtual="auto" {...pipeline.getProps()} />;
};
